PHP Gallery
PHP Gallery is a free php image script.
Evil gear
Christmas is almost here
Sell your soul
Believeth in me an hath everlasting life
Sharp Stuff
Switchblades Icepicks and german knives

here are some of the best and useful php scripts and snippets to help in your projects. Php displayed below. Use the search for specific script lookups. Click the category links to view scripts in Javascript and cgi. To add your own script click the link and add your useful script example.

parse a csv file associative array delimited file data return using fgetscsv indexed by the first row values 
fgetscsv delimited csv file array associative

<?php
function csv_to_array($filename=''$delimiter=';')
{
if(!
file_exists($filename) || !is_readable($filename))
return 
FALSE;
$header NULL;
$data = array();
if ((
$handle fopen($filename'r')) !== FALSE)
{
while ((
$row fgetcsv($handle1000$delimiter)) !== FALSE)
{
if(!
$header)
$header $row;
else
$data[] = array_combine($header$row);
}
fclose($handle);
}
return 
$data;
}
 

echo 
'<pre>';
//can add as many column names you like see format
var_dump(csv_to_array('cart-data2.txt')); 
echo 
'</pre>';
exit;
?>


Add your comment.













No comments yet

Search ScriptsnTips


Php JavaScripts CGI/Perl